import React from "react";
import { connect } from 'umi';
import TableDataBlock from '@/components/TableDataBlock';
import city from '@/common/city'
import './index.less'
const AnsweringUpgradePlan = (props) => {
    const { list, loading } = props
    const searchItems = [
        {
            label: '用户姓名或手机',
            name: 'keyword',
        },
        {
            label: '意向学校',
            name: 'intentionSchool',
        },
        {
            label: '升本方向',
            name: 'planDirection',
            type: 'select',
            select: {
                '统招专升本': '统招专升本',
                '成考专升本': '成考专升本',
                '自考专升本': '自考专升本',
                '成考高起专': '成考高起专',
                '其他': '其他',

            }
        },



        {
            label: '省份',
            name: 'province',
            type: 'cascader',
            fieldNames: { label: 'label', value: 'label' },
            select: city.map(val => {
                return {
                    ...val, children: []
                }
            })
        },
        {
            label: '规划类型',
            name: 'planType',
            type: 'select',
            select: {
                '高考类': '高考类',
                '专升本类': '专升本类',
            }
        },
    ]
    const getColumns = [
        {
            title: '姓名',
            dataIndex: 'username',
        },
        {
            title: '填写的用户姓名',
            dataIndex: 'recordUsername',
        },
        {
            title: '手机号',
            dataIndex: 'mobile',
        },
        {
            title: '微信号',
            dataIndex: 'recordWechatId',
        },
        {
            title: '省份',
            dataIndex: 'province',
        },

        {
            title: '学科',
            dataIndex: 'subject',
        },
        {
            title: '分数',
            dataIndex: 'score',
        },

        {
            title: '规划类型',
            dataIndex: 'planType',
            render: (e) => {
                return {
                    '高考类': '高考类',
                    '专升本类': '专升本类'
                }[e]
            }
        },
        {
            title: '升本方向 ',
            dataIndex: 'planDirection',
        },
        {
            title: '采集时间',
            dataIndex: 'createTime',
        },


    ];
    return <TableDataBlock
        loading={loading}
        searchItems={searchItems}
        columns={getColumns}
        rowKey={(record) => `${record.id}`}
        dispatchType="answering/fetchTempUpgradePlanRecord"
        {...list}
    ></TableDataBlock>
}
export default connect(({ answering, loading }) => ({
    list: answering.tempUpgradePlanRecordList
}))(AnsweringUpgradePlan);
